package com.sinog.front.controller.biz;

import com.sinog.core.model.UserDTO;
import com.sinog.core.utilbean.Result;
import com.sinog.front.config.idempotent.Idempotent;
import com.sinog.front.config.log.Log;
import com.sinog.front.feign.biz.MediaService;
import com.sinog.front.service.user.UserFacade;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @desc 预安置管理 - 预安置人员信息管理 - 新增 - 多媒体信息
 * @author -
 * @date 2020-02-04 14:14
 */
@RestController
public class MediaController {

    @Resource
    private MediaService mediaService;
    @Resource
    private UserFacade userService;

    /**
     * 保存罪犯多媒体信息
     * @param request request
     * @param prinum prinum
     * @param id id
     * @return Result
     */
    @Log(type = "更新", value = "保存罪犯多媒体信息")
    @Idempotent(paramPos = {1,2})
    @PostMapping("/azbj/social/multi/save")
    public Result saveMediainfo(HttpServletRequest request,
                                @RequestParam(required = false, defaultValue = "-1") String prinum,
                                @RequestParam(required = false, defaultValue = "-1") String id) {
        UserDTO user = userService.getAuthentication();
        return mediaService.addMediaInfo(prinum,id,user);
    }
}